﻿namespace ReactiveGraph.Uat.ResolvableValueUat
{
    public class ValidationState
    {
        public string Message { get; set; }
        public bool IsError { get; set; }

        public bool Equals(ValidationState other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.Message, Message) && other.IsError.Equals(IsError);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (ValidationState)) return false;
            return Equals((ValidationState) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return ((Message != null ? Message.GetHashCode() : 0)*397) ^ IsError.GetHashCode();
            }
        }
    }
}